package com.web.serviceimpl;

import com.web.dao.StudentDao;
import com.web.daoimpl.StudentDaoImpl;
import com.web.entity.Grade;
import com.web.entity.Stu_admin;
import com.web.entity.Student;
import com.web.service.StudentService;
import java.util.List;

/**
 *
 * @author 12270
 */
public class StudentServiceImpl implements StudentService{
    
    StudentDao studentDao = new StudentDaoImpl();

    @Override
    //学生
    public void insertNewStudent(Student s) {
        StudentDaoImpl srs=new StudentDaoImpl();
        srs.insertNewStudent(s);
    }
    
    @Override
    public int RegistrationVerification(Student s) {
        StudentDaoImpl sr=new StudentDaoImpl();
        Student xs=sr.getOneBySid(s.getSid());
        if(null!=xs){
            int a=1;
            return a;
        }
        else{
            int a=0;
            return a;
        }
    }


    @Override
    public List<Student> findStudentsByClassID(String ClassID) {
            return studentDao.findStudentsByClassID(ClassID);
        }



    @Override
    public Student findStudentBykeyword(String keyword) {
        return studentDao.findStudentBykeyword(keyword);
    }
    @Override
    public int modifyStudentInfo(Student s) {
        return studentDao.update(s);
    }

    @Override
    public int modifyStudentPwd(Student s) {
        return studentDao.updateSpwd(s);
    }

    @Override
    //学生
    public Student studentLogin(String Sid, String Spwd) {
        Student s = studentDao.getOneBySid(Sid);
        if(null!=s&&s.getSpwd().equals(Spwd))
            return s;
        else{
            return null;
        }
    }

    public int update(Student s) {
        return studentDao.update(s);
    }

    public int updateSpwd(Student s) {
        return studentDao.updateSpwd(s);
    }


    @Override
    public Student findStudentBySid(String Sid) {
        return studentDao.getOneBySid(Sid);
    }

    
}
